<template>
  <page-header-wrapper>
    <a-card :bordered="false">
      <div class="table-operator">
        <a-form layout="inline">
          <a-form-item>
            <a-input placeholder="手机号" v-model="queryParam.mobile"></a-input>
          </a-form-item>
          <a-form-item>
            <a-button type="primary" @click="handleSearch(true)" icon="search">查询</a-button>
          </a-form-item>
        </a-form>
      </div>
      <s-table
        ref="table"
        size="default"
        rowKey="id"
        :columns="columns"
        :data="loadData"
        showPagination="auto"
        :pagination="pagination"
      >
        <template slot="img" slot-scope="text">
          <a-avatar
            shape="square"
            :size="48"
            icon="user"
            :src="item"
            v-for="item in text"
            :key="item"
            style="margin-right:10px;cursor: pointer;"
            @click.native="$refs.preModal.preview(item)"
          />
        </template>
      </s-table>
    </a-card>
    <pre-modal ref="preModal"></pre-modal>
  </page-header-wrapper>
</template>

<script>
import { feedbackList } from '@/api/stat'
import formTableMixin from '@/mixins/formTableMixin'
import PreModal from '@/components/pre-modal'
const columns = [
  {
    title: '名称',
    dataIndex: 'name'
  },
  {
    title: '手机号',
    dataIndex: 'mobile'
  },
  {
    title: '图片',
    dataIndex: 'img',
    scopedSlots: { customRender: 'img' }
  },
  {
    title: '内容',
    dataIndex: 'content'
  },
  {
    title: '反馈时间',
    dataIndex: 'ctime'
  }
  // {
  //   title: '操作',
  //   dataIndex: 'action',
  //   width: '150px',
  //   scopedSlots: { customRender: 'action' }
  // }
]

export default {
  name: 'FeedbackList',
  mixins: [formTableMixin],
  components: {
      PreModal
  },
  data () {
    this.columns = columns
    this.listAction = parameter =>
      feedbackList(parameter).then(res => {
        const data = res.data.data
        data.forEach(item => {
          try {
            item.img = JSON.parse(item.img)
            item.img.push(...item.img)
          } catch (error) {}
        })
        return res
      })
    return {}
  }
}
</script>
